package com.swpu.cbg.myninegriddemo;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

import com.swpu.cbg.myninegriddemo.Widget.NineGridlayout;
import com.swpu.cbg.myninegriddemo.bean.Image;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private NineGridlayout mLayout;
    private List<Image> images;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
    }

    private void initData() {
        images = new ArrayList<>();
        images.add(new Image(R.mipmap.img1));
        images.add(new Image(R.mipmap.img2));
        images.add(new Image(R.mipmap.img3));
        images.add(new Image(R.mipmap.img4));
        images.add(new Image(R.mipmap.img5));
        images.add(new Image(R.mipmap.img6));
        images.add(new Image(R.mipmap.img7));
        images.add(new Image(R.mipmap.img8));
        images.add(new Image(R.mipmap.img9));
        mLayout.setImagesData(images);
    }

    private void initView() {
        mLayout = (NineGridlayout) findViewById(R.id.id_grid);

    }

}
